home *** CD-ROM | disk | FTP | other *** search
- /* Script to save a dictionary of HBasic OS3 file1 */
-
-
- /* get the directory path of the images */
- PARSE ARG dirname
-
- /* strip extranneous spaces and quotes */
- dirname = STRIP(dirname)
- dirname = STRIP(dirname,"b",'"')
- dirname = STRIP(dirname)
-
- IF RIGHT(dirname,1) ~= "/" & RIGHT(dirname,1) ~=":" then ; dirname=dirname||"/"
-
- /* create a list of BH files in the temporary file in RAM */
- commandline = "list >ram:"||tempname||" "dirname"#?.(bc) files LFORMAT %P%S"
- ADDRESS COMMAND commandline
- ADDRESS COMMAND 'c:Sort RAM:tempname TO RAM:tamlist.temp'
-
- /* Open the file and read in names to filename compound variable */
- inname = "ram:tamlist.temp"
- q = OPEN("infile", inname, "R")
- filecount = 1
-
- do UNTIL EOF("infile")
- filename.filecount = READLN("infile")
- filecount = filecount+1
- end
-
- /* Remember to close and delete the temporary file */
- CALL CLOSE("infile")
-
-
- ADDRESS COMMAND "delete ram:"||tempname
-
- SAY filecount "Files have been found"
-
-
- /* CREATE OUTPUT FILES */
- CALL OPEN(file1, "Ram:Constants", "W")
-
- DO loop = 1 to filecount-2 /* MAIN LOOP */
-
- File=filename.loop
- CALL WRITELN(FILE1, "/*" File "*/")
-
- LineLength=0
-
- CALL OPEN("Data_File", File, "R")
- DO UNTIL EOF("Data_File")
- Textline = READLN("Data_File")
- TYPE = CHECKTYPE(Textline)
- IF TYPE="CONST" THEN ; LineLength=FileWrite(LineLength,FILE1)
- END
- CALL WRITELN(FILE1, "");CALL WRITELN(FILE1, "")
- CALL CLOSE("Data_File")
-
-
- END /* END of Main Loop */
-
- /* Close Output Files */
- CALL CLOSE(file1)
-
- EXIT
-
- CHECKTYPE: EXPOSE Header
- TYPE = WORD(Textline,1)
- Header = WORD(Textline,2)
- P = POS("=",Header)
- IF P ~=0 THEN; Header= LEFT(Header,P-1)
- RETURN TYPE
-
- FILEWRITE: PROCEDURE Expose Header
- LineLength = Arg(1)
- FILE = Arg(2)
- LineLength = LineLength + LENGTH(Header)
- IF LineLength > 120 THEN
- DO
- CALL WRITELN(FILE,"")
- LineLength = LENGTH(Header)
- END
- CALL WRITECH(FILE,Header||" ")
- RETURN LineLength
-
-
-
-
-
-